<html>
<head><meta charset="utf-8"><title>ungrammar and rowan · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ungrammar.20and.20rowan.html">ungrammar and rowan</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="228397762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ungrammar%20and%20rowan/near/228397762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ungrammar.20and.20rowan.html#228397762">(Mar 02 2021 at 12:00)</a>:</h4>
<p>Heya! -- I'm trying to get more familiar with Rust's parser infastructure, and one thing I'm unclear about is what the role of <code>rowan</code> is and what the role of <code>ungrammar</code> is. Both seem to be used within Rust-Analyzer -- and it seems I might be missing a bit of understanding what each of these is best suited for?</p>



<a name="228398233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ungrammar%20and%20rowan/near/228398233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ungrammar.20and.20rowan.html#228398233">(Mar 02 2021 at 12:04)</a>:</h4>
<p>Rowan is a data structure for a concrete syntax tree. The parser, the code that turns text into a rowan tree, is the <code>parser</code> inside rust-analyzer.</p>
<p>Concrete syntax tree is dynamically typed (think <code>serde_json::Value</code>), <code>ungrammar</code> is tool we used to layer typed access methods over the underlying tree.</p>



<a name="228398263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ungrammar%20and%20rowan/near/228398263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ungrammar.20and.20rowan.html#228398263">(Mar 02 2021 at 12:05)</a>:</h4>
<p>Also <a href="https://rust-analyzer.github.io/blog/2020/10/24/introducing-ungrammar.html">https://rust-analyzer.github.io/blog/2020/10/24/introducing-ungrammar.html</a></p>



<a name="228398362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ungrammar%20and%20rowan/near/228398362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ungrammar.20and.20rowan.html#228398362">(Mar 02 2021 at 12:06)</a>:</h4>
<p><em>ohh</em>, yes okay that makes sense</p>



<a name="228398423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ungrammar%20and%20rowan/near/228398423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ungrammar.20and.20rowan.html#228398423">(Mar 02 2021 at 12:06)</a>:</h4>
<p>thank you</p>



<a name="228398523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ungrammar%20and%20rowan/near/228398523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ungrammar.20and.20rowan.html#228398523">(Mar 02 2021 at 12:07)</a>:</h4>
<p><span class="user-mention" data-user-id="203546">@Laurențiu Nicola</span> hehe, yeah I've been combing over that article for the past day -- I had some trouble getting the relationship between the various components click</p>



<a name="228398686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ungrammar%20and%20rowan/near/228398686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ungrammar.20and.20rowan.html#228398686">(Mar 02 2021 at 12:08)</a>:</h4>
<p>There's also a bunch of notes and links in <a href="https://github.com/KirillOsenkov/Bliki/wiki/Roslyn-Immutable-Trees">https://github.com/KirillOsenkov/Bliki/wiki/Roslyn-Immutable-Trees</a></p>



<a name="228398750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ungrammar%20and%20rowan/near/228398750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ungrammar.20and.20rowan.html#228398750">(Mar 02 2021 at 12:09)</a>:</h4>
<p>oh! -- I've heard of Roslyn, will check it out -- thank you!</p>



<a name="228398888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ungrammar%20and%20rowan/near/228398888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ungrammar.20and.20rowan.html#228398888">(Mar 02 2021 at 12:10)</a>:</h4>
<p>I don't remember much of the details, but I think Roslyn was the first implementation (for C#), <code>libsyntax</code> took a similar approach, but doesn't rely as much on a GC, and <code>rowan</code> is still evolving.</p>



<a name="228398957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ungrammar%20and%20rowan/near/228398957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ungrammar.20and.20rowan.html#228398957">(Mar 02 2021 at 12:11)</a>:</h4>
<p>matklad can surely say more :)</p>



<a name="228398977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ungrammar%20and%20rowan/near/228398977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ungrammar.20and.20rowan.html#228398977">(Mar 02 2021 at 12:11)</a>:</h4>
<p>hmm, question: I believe Rust-Analyzer is considering moving to <em>mutable</em> trees at some point in the future? - would that deviate much from how Rust-Analyzer's components work today?</p>



<a name="228399103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ungrammar%20and%20rowan/near/228399103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ungrammar.20and.20rowan.html#228399103">(Mar 02 2021 at 12:12)</a>:</h4>
<p>/me realizes they should read the mutable tree RFC more closely</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>